/**
 * num 根据传入的个数来匹配num个随机色
 */
var chartColor = ['#4772FF', '#00BDFF', '#48E5FF', '#16F499', '#E4FF48', '#FFB948', '#FF4848', '#FF48B1', '#B348FF', '#002DAD', '#f55e59', '#b3f327', '#d75cff', '#05cdff', '#3beba7', '#9a57ff', '#ffd300',
	'#ffb833', '#a1de8e', '#ffad8a', '#eb5ee1', '#98adff', '#1dc9b7', '#ffd300', '#7ce4ef', '#a87cef', '#ef7cd1', '#7ccfef', '#efc17c', '#7cec95'
];
export default {
	setRandomColor: function(num) { //设置RGB随机色
		if(num) {
			var colorArr = [];
			for(var i = 1; i < num; i++) {
				var r = Math.round(Math.random() * 255),
					g = Math.round(Math.random() * 255),
					b = Math.round(Math.random() * 255);
				var color = "#" + (r << 16 | g << 8 | b).toString(16);
				colorArr.push(color)
			}
			return colorArr
		} else {
			var r = Math.round(Math.random() * 255),
				g = Math.round(Math.random() * 255),
				b = Math.round(Math.random() * 255);
			var color = "#" + (r << 16 | g << 8 | b).toString(16);
			return color
		}
	},
	setColorBasicInfoFocusJL: function(len) {
		var colorArrFocusJL = [
			'#004ACC',
			'#00BEFF',
			'#FF3838',
			'#FF48B1',
			'#B348FF',
			'#002DAD',
			'#f55e59',
			'#b3f327',
			'#d75cff',
			'#05cdff',
			'#3beba7',
			'#9a57ff',
			'#ffd300',
			'#ffb833',
			'#a1de8e',
			'#ffad8a',
			'#eb5ee1',
			'#98adff',
			'#1dc9b7',
			'#ffd300',
			'#7ce4ef',
			'#a87cef',
			'#ef7cd1',
			'#7ccfef',
			'#efc17c',
			'#7cec95'
		]
		if(len) {
			var arr = [];
			for(var i = 0; i < len; i++) {
				if(colorArrFocusJL.length < len) {
					var curlen = len - colorArrFocusJL.length;
					var fillUp = []
					for(var j = 1; j < curlen; j++) {
						var r = Math.round(Math.random() * 255),
							g = Math.round(Math.random() * 255),
							b = Math.round(Math.random() * 255);
						var color = "#" + (r << 16 | g << 8 | b).toString(16);
						fillUp.push(color)
					}
					arr = colorArrFocusJL.concat(fillUp)
					//arr.push(colorArr[i])
				}
				arr.push(colorArrFocusJL[i])
			}
			return arr;
		}
	},
	setColorBasicInfoFocusSG: function(len) {
		var colorArrFocus = [
			'#FF3838',
			'#16F49A',
			'#FFAC34',
			'#4872FF',
			'#E4FF48',
			'#B448FF',
			'#ff33ee',
			//'#FF3838',
			'#FF48B1',
			'#B348FF',
			'#002DAD',
			'#f55e59',
			'#b3f327',
			'#d75cff',
			'#05cdff',
			'#3beba7',
			'#9a57ff',
			'#ffd300',
			'#ffb833',
			'#a1de8e',
			'#ffad8a',
			'#eb5ee1',
			'#98adff',
			'#1dc9b7',
			'#ffd300',
			'#7ce4ef',
			'#a87cef',
			'#ef7cd1',
			'#7ccfef',
			'#efc17c',
			'#7cec95'
		]
		if(len) {
			var arr = [];
			for(var i = 0; i < len; i++) {
				if(colorArrFocus.length < len) {
					var curlen = len - colorArrFocus.length;
					var fillUp = []
					for(var j = 1; j < curlen; j++) {
						var r = Math.round(Math.random() * 255),
							g = Math.round(Math.random() * 255),
							b = Math.round(Math.random() * 255);
						var color = "#" + (r << 16 | g << 8 | b).toString(16);
						fillUp.push(color)
					}
					arr = colorArrFocus.concat(fillUp)
					//arr.push(colorArr[i])
				}
				arr.push(colorArrFocus[i])
			}
			return arr;
		}
	},
	setColor: function(len) { //根据已有颜色匹配
		var colorArr = [
			//注释前6个
			'#4772FF',
			'#00BDFF',
			'#48E5FF',
			'#16F499',
			'#E4FF48',
			'#FFAC34',
			//'#ffb948',
			//'#FF4848',
			'#FF3838',
			'#FF48B1',
			'#B348FF',
			'#002DAD',
			'#f55e59',
			'#b3f327',
			'#d75cff',
			'#05cdff',
			'#3beba7',
			'#9a57ff',
			'#ffd300',
			'#ffb833',
			'#a1de8e',
			'#ffad8a',
			'#eb5ee1',
			'#98adff',
			'#1dc9b7',
			'#ffd300',
			'#7ce4ef',
			'#a87cef',
			'#ef7cd1',
			'#7ccfef',
			'#efc17c',
			'#7cec95'
		];
		if(len) {
			var arr = [];
			for(var i = 0; i < len; i++) {
				if(colorArr.length < len) {
					var curlen = len - colorArr.length;
					var fillUp = []
					for(var j = 1; j < curlen; j++) {
						var r = Math.round(Math.random() * 255),
							g = Math.round(Math.random() * 255),
							b = Math.round(Math.random() * 255);
						var color = "#" + (r << 16 | g << 8 | b).toString(16);
						fillUp.push(color)
					}
					arr = colorArr.concat(fillUp)
					//arr.push(colorArr[i])
				}
				arr.push(colorArr[i])
			}
			return arr;
		}
	},
	nomalPieFun(optionObj) { //常规饼图legend, series
		var option = {
			legend: {
				show: optionObj.legend ? optionObj.legend.show : false,
				orient: optionObj.legend ? optionObj.legend.orient : 'horizontal',
				icon: 'circle',
				bottom: optionObj.legend ? optionObj.legend.bottom : 20,
				x: 'center',
				textStyle: {
					color: '#666'
				},
				data: optionObj.legend ? optionObj.legend.data : '暂无数据'
			},
			tooltip: optionObj.tooltip ? optionObj.tooltip : {
				trigger: 'item',
				transitionDuration: 0, //防止tooltip的抖动
				formatter: "{b}<br/>占比： {d}%"
			},
			visualMap: {
				show: false,
				min: 500,
				max: 600,
				inRange: {
					//colorLightness: [0, 1]
				}
			},
			series: [{
				name: optionObj.series ? optionObj.series.name : '',
				type: 'pie',
				radius: optionObj.series ? optionObj.series.radius : ['35%', '60%'],
				center: optionObj.series ? optionObj.series.center : ["50%", "50%"],
				avoidLabelOverlap: false,
				color: optionObj.series ? optionObj.series.color : ['#1ed87e', '#ffb000'],
				label: {
					show: false,
					position: 'center',
					formatter: function(val) { //让series 中的文字进行换行
						if(optionObj.series.formatter) {
							return val.name.split(" ").join("\n");
						} else {
							return ''
						}
					},
				},
				labelLine: {
					show: optionObj.series ? optionObj.series.labelLineShow : false,
					normal: {
						lineStyle: {
							color: 'rgb(98,137,169)',
						},
						smooth: 0.2,
						length: 10,
						length2: 20,
					}
				},
				itemStyle: {
					normal: {
						borderColor: "#fff",
						borderWidth: 1
					}
				},
				emphasis: {
					label: {
						show: true,
						fontSize: '14',
					}
				},
				data: optionObj.series ? optionObj.series.data : null
			}]
		};
		if(optionObj.legend2) {
			option.push(optionObj.legend2)
		}
		return option;
	},
	rosePieFun(optionObj) { //南丁格尔玫瑰图 - 饼图legend, series
		var option = {
			legend: {
				type: "scroll",
				orient: 'horizontal',
				icon: 'circle',
				bottom: 20,
				x: 'center',
				textStyle: {
					color: '#666'
				},
				data: optionObj.legend ? optionObj.legend.data : null,
				selected: optionObj.legend ? optionObj.legend.selected : ''
			},
			grid: {
				left: optionObj.grid ? optionObj.grid.left : 10,
				right: optionObj.grid ? optionObj.grid.right : 20,
				top: optionObj.grid ? optionObj.grid.top : 10,
				bottom: optionObj.grid ? optionObj.grid.bottom : 10
			},
			tooltip: {
				trigger: 'item',
				transitionDuration: 0, //防止tooltip的抖动
				formatter: "{b} : {c} ({d}%)"
			},

			// visualMap: {
			// 	show: false,
			// 	min: 500,
			// 	max: 600,
			// 	inRange: {
			// 		//colorLightness: [0, 1]
			// 	}
			// },
			series: [{
				name: optionObj.series ? optionObj.series.name : '',
				type: 'pie',
				minAngle: optionObj.series ? optionObj.series.minAngle : null,
				radius: optionObj.series.radius ? optionObj.series.radius : ['35%', '60%'], //'50%',
				center: optionObj.series.center ? optionObj.series.center : ['50%', '45%'], //['50%', '50%'],
				color: optionObj.series ? optionObj.series.color : '#999',
				data: optionObj.series ? optionObj.series.data.sort(function(a, b) {
					return b.value - a.value
				}) : null,
				roseType: 'radius',

				label: {
					normal: {
						formatter: ['{c|{c}%}', '{b|{b}}'].join('\n'),
						rich: {
							c: {
								// color:'',
								fontSize: 14,
								fontWeight: 'bold',
								lineHeight: 5
							},
							b: {
								//color: '',
								fontSize: 12,
								height: 20
							},
						},
					}
				},
				labelLine: {
					show: false,
					normal: {
						//					                lineStyle: {
						//					                    color: function(value, index) {
						//					                    	debugger
						//						                    var num = myColor.length;
						//						                    return myColor[index % num]
						//						                },
						//					                },
						smooth: false,
						//						length: 20,
						//						length2: 15,

					}
				},
				itemStyle: {
					normal: {
						//shadowColor: 'rgba(0, 0, 0, 0.8)',
						//shadowBlur: 50,
					}
				}
			}]
		};
		return option
	},
	progressBar(optionObj) { //进度条样式bar

		var option = {
			//		    legend: {
			//		        bottom: 20,
			//		        textStyle: {
			//		            color: '#fff',
			//		        },
			//		        data: optionObj.legend?optionObj.legend.data:[]
			//		    },
			grid: {
				top: optionObj.grid ? optionObj.grid.top : 10,
				left: optionObj.grid ? optionObj.grid.left : '3%',
				right: optionObj.grid ? optionObj.grid.right : '2%',
				bottom: optionObj.grid ? optionObj.grid.bottom : '10%',
				containLabel: optionObj.grid ? optionObj.grid.containLabel : true
			},

			xAxis: {

				type: 'value',
				axisTick: {
					show: false
				},
				axisLine: {
					show: false
				},
				splitLine: {
					show: false
				},
				axisLabel: {
					show: false
				}
			},
			yAxis: [{
					// type: 'category',
					axisTick: {
						show: false
					},
					axisLine: {
						show: false
					},
					axisLabel: {
						show: false
					},
					data: optionObj.yAxis ? optionObj.yAxis.data : [] //
				},
				{
					show: true,
					//inverse: true,倒叙
					data: optionObj.yAxis ? optionObj.yAxis.data2 : [],
					axisLabel: {
						textStyle: {
							fontSize: 12,
							color: '#333',
						},
					},
					axisLine: {
						show: false
					},
					splitLine: {
						show: false
					},
					axisTick: {
						show: false
					},

				}
			],
			series: [{
					name: '实出勤', //背景灰色bar
					type: 'bar',
					yAxisIndex: 1,
					barMaxWidth: 10,
					cursor: 'default',
					itemStyle: {
						normal: {
							show: true,
							color: '#EBEEF5',
							barBorderRadius: 50,
							borderWidth: 0,
							borderColor: '#333',
						},
						emphasis: {
							color: '#EBEEF5'
						},
					},
					barGap: '0%',
					barCategoryGap: '50%',
					data: optionObj.series ? optionObj.series.data : [],
				},
				{
					name: '应出勤', //上面的颜色bar
					type: 'bar',
					barMaxWidth: 10,
					itemStyle: {
						normal: {
							show: true,
							color: function(params) {
								var num = optionObj.yAxis.data.length;
								return optionObj.yAxis.axisLabelColor[params.dataIndex % num]
							},

							barBorderRadius: 50,
							borderWidth: 0,
							borderColor: '#333',
						}
					},
					barGap: '0%',
					barCategoryGap: '50%',
					data: optionObj.series ? optionObj.series.data2 : [],
					label: {
						show: false,
						normal: {
							show: true,
							position: [0, '-24px'],
							textStyle: {
								fontSize: 14
							},
							formatter: function(a, b) {
								return a.name
							}
						}
					}
				}

			]
		};
		return option;
	},
	horizontalBar(optionObj) { //水平柱形图grid, yAxis, series
		var option = {
			grid: {
				top: optionObj.grid ? optionObj.grid.top : '5%',
				bottom: optionObj.grid ? optionObj.grid.bottom : 0,
				left: optionObj.grid ? optionObj.grid.left : 0,
				right: optionObj.grid ? optionObj.grid.right : 0
			},
			xAxis: {
				show: false
			},
			yAxis: [{
					show: true,
					data: optionObj.yAxis ? optionObj.yAxis.data : '',
					inverse: true, //柱状图反向
					max: 5,
					axisLine: {
						show: false
					},
					splitLine: {
						show: false
					},
					axisTick: {
						show: false
					},
					axisLabel: {
						textStyle: {
							color: function(value, index) {
								var num = optionObj.yAxis.data.length;
								return optionObj.yAxis.axisLabelColor[index % num]
							},
							//padding: optionObj.yAxis.axisLabelpadding ? optionObj.yAxis.axisLabelpadding : [-30, -30, 0, 0]
						},
						formatter: function(value, index) {
							return [
								'{title|' + value + '} '
							].join('\n')
						},
						rich: {}
					},
				},
				{
					show: true,
					inverse: true,
					max: 5,
					data: optionObj.yAxis ? optionObj.yAxis.data2 : '',
					axisLabel: {
						textStyle: {
							color: function(value, index) {
								var num = optionObj.yAxis.data2.length;
								return optionObj.yAxis.axisLabelColor[index % num]
							}
						}
					},
					axisLine: {
						show: false
					},
					splitLine: {
						show: false
					},
					axisTick: {
						show: false
					},
				}
			],
			series: [{
				name: optionObj.series ? optionObj.series.name : '',
				type: 'bar',
				yAxisIndex: 0,
				data: optionObj.series ? optionObj.series.data : null,
				// barWidth: optionObj.series.barWidth?optionObj.series.barWidth:15,
				barGap: optionObj.series ? optionObj.series.barGap : '-100%', //间距
				barCateGoryGap: optionObj.series ? optionObj.series.barCateGoryGap : 10, //间距
				barWidth: 15,
				//barGap:'80%',
				//barCateGoryGap:20,
				itemStyle: {
					normal: {
						barBorderRadius: 10,
						fontSize: 12,
						color: function(params) {
							var num = optionObj.series.data.length;
							return optionObj.yAxis.axisLabelColor[params.dataIndex % num]
						},
					}
				},
				label: {
					normal: {
						show: true,
						position: 'inside',
						formatter: '{c}%',
					}
				},
			}]
		};
		return option
	},
  verticalBar(optionObj) { //xAxis,yAxis,series垂直柱形图 ,可直接用下面more 方法
    var arrSeries = [];
		for(var i = 0; i < optionObj.series.data.length; i++) {
			var curSeries = {
				name: optionObj.series.data[i].name,
				value: optionObj.series.data[i].value,
				itemStyle: {
					normal: {
						color: optionObj.series.data[i].color,
					}
				}
			};
			arrSeries.push(curSeries)
		}

		var option = {
			title: {
				text: optionObj.title ? optionObj.title.text : '单位：次',
				textStyle: {
					fontWeight: 'normal',
					fontSize: 14,
					color: '#666'
				},
				padding: optionObj.title ? optionObj.title.padding : [20, 10, 0, 15]
			},
			grid: {
				left: optionObj.grid ? optionObj.grid.left : '5%',
				top: optionObj.grid ? optionObj.grid.top : '5%',
				bottom: optionObj.grid ? optionObj.grid.bottom : '5%',
				right: optionObj.grid ? optionObj.grid.right : '2%'

			},
			tooltip: {
				transitionDuration: 0, //防止tooltip的抖动
				trigger: 'axis',
				axisPointer: {
					type: 'shadow'
				}
			},
			legend: {
				data: optionObj.legend ? optionObj.legend.data : null,
				type: optionObj.legend ? optionObj.legend.type : "scroll",
				orient: 'horizontal',
				x: '200px',
				y: '200px',
				bottom: 0,
				align: optionObj.legend ? optionObj.legend.align : 'left',
				textStyle: {
					color: "#666"
				},
				itemWidth: 10,
				itemHeight: 10,
				itemGap: 35
			},
			xAxis: [{
				type: 'category',
				axisLine: {
					lineStyle: {
						color: ['#999'],
					}
				},
				axisLabel: {
					textStyle: {
						color: '#666'
					},
					interval: optionObj.xAxis.axisLabel ? optionObj.xAxis.axisLabel.interval : 0,
					rotate: optionObj.xAxis.axisLabel ? optionObj.xAxis.axisLabel.rotate : 0,
				},
				axisTick: {
					show: false
				},
				splitLine: {　　　　
					show: false
				},
				data: optionObj.xAxis ? optionObj.xAxis.data : null
			}],
			yAxis: {
				type: 'value',
				name: optionObj.yAxis ? optionObj.yAxis.name : '',
				minInterval: 1,
				nameTextStyle: {
					fontSize: 14,
					color: '#666'
				},
				axisLine: {
					show: false,
					lineStyle: {
						color: ['#999'],
					}
				},
				axisLabel: {
					formatter: '{value}',
					textStyle: {
						color: '#666'
					}
				},
				axisTick: {
					show: false,
				},
				splitLine: optionObj.yAxis && optionObj.yAxis.splitLine ? optionObj.yAxis.splitLine : {
					show: true,
					lineStyle: {
						color: ['#fbebeb'],
						type: 'dashed'
					}
				}
			},
			series: [{
				name: optionObj.series ? optionObj.series.name : '',
				type: 'bar',
				barWidth: optionObj.series.barWidth ? optionObj.series.barWidth : 20,
				data: arrSeries
			}]
		};
		return option
	},
	moreVerticalBar(optionObj) { //legend,xAxis,series
		var arrSeries = [];
		if(optionObj.series) {
			for(var i = 0; i < optionObj.series.length; i++) {
				var curSeries = {
					name: optionObj.series[i].name,
					type: 'bar',
					barGap:optionObj.series[i] && optionObj.series[i].barGap,
					stack: optionObj.stack, // 是否堆叠
					data: optionObj.series[i].data,
					barWidth: optionObj.series[i] ? optionObj.series[i].barWidth : '15%',
					itemStyle: {
						normal: {
							color: optionObj.series[i].color,
						}
					}
				};
				arrSeries.push(curSeries)
			}
		}

		var option = {
			tooltip: {
				show: true,
				transitionDuration: 0, //防止tooltip的抖动
				trigger: 'axis',
				axisPointer: {
					type: 'shadow'
				}
			},
			//dataZoom: optionObj.dataZoom ? optionObj.dataZoom : [],
			title: {
				text: optionObj.title ? optionObj.title.text : "单位:kWh",
				padding: optionObj.title ? optionObj.title.padding : [20, 0, 0, 20],
				color: optionObj.title ? optionObj.title.color : "#959cbc"
			},
			grid: {
				left: optionObj.grid ? optionObj.grid.left : '5%',
				top: optionObj.grid ? optionObj.grid.top : '15%',
				bottom: optionObj.grid ? optionObj.grid.bottom : '10%',
				right: optionObj.grid ? optionObj.grid.right : '2%',
				containLabel: true
			},
			legend: {
				type: "scroll",
				orient: 'horizontal',
				bottom: optionObj.legend ? optionObj.legend.bottom : 20,
				//				right:optionObj.legend ? optionObj.legend.right:0,
				//				top:optionObj.legend ? optionObj.legend.top:0,
				//				data: optionObj.legend ? optionObj.legend.data : null,
				align: 'left',
				textStyle: {
					color: "#666"
				},
				itemWidth: 10,
				itemHeight: 10,
				itemGap: 35
			},
			xAxis: [{
				type: optionObj.xAxis ? optionObj.xAxis.type : 'category',
				name: optionObj.xAxis ? optionObj.xAxis.name : null,
				data: optionObj.xAxis ? optionObj.xAxis.data : null,
				axisLine: {
					lineStyle: {
						color: optionObj.xAxis.axisLine ? optionObj.xAxis.axisLine.lineStyle.color : ['#ccc'],
					}
				},
				axisLabel: { //X轴文字
					textStyle: {
						color: optionObj.xAxis.axisLabel ? optionObj.xAxis.axisLabel.textStyle : ['#333']
					},
					interval: optionObj.xAxis.axisLabel ? optionObj.xAxis.axisLabel.interval : 0,
					rotate: optionObj.xAxis.axisLabel ? optionObj.xAxis.axisLabel.rotate : 0
				},
				// axisLine: {
				// 	lineStyle: {
				// 		color: ['#ccc'],
				// 	}
				// },
				// axisLabel: {
				// 	textStyle: {
				// 		color: '#666'
				// 	}
				// },
				axisTick: {
					show: false
				},
				splitLine: {　　　　
					show: false
				}
			}],
			yAxis: [{
				type: optionObj.yAxis ? optionObj.yAxis.type : 'value',
				name: optionObj.yAxis ? optionObj.yAxis.name : null,
				ayisLine: {
					show: false
				},
				minInterval: 1,
				axisLabel: {
					//					formatter: `{value}${optionObj.yAxis.axisLabel}`,
					textStyle: {
						color: '#5c6076'
					}
				},
				axisLine: {
					show: false,
					lineStyle: {
						color: '#384157'
					}
				},
				axisTick: {
					show: false
				},
				splitLine: {
					show: true,
					lineStyle: {
						color: ['#ebebeb'],
					}
				}
			}],
			series: arrSeries
		};
		return option
	},
	normalLine(optionObj) { //(option) { //折线
		var arrSeries = [];
		if(optionObj.series) {
			for(var i = 0; i < optionObj.series.length; i++) {
				var curSeries = {
					name: optionObj.series ? optionObj.series[i].name : 'line',
					type: 'line',
					smooth: true,
					symbolSize: 10,
					animation: false,
					lineWidth: 1.2,
					hoverAnimation: false,
					symbol: 'circle',
					lineStyle: {
						normal: {
							width: 2,
							color: chartColor[i],
						}
					},
					itemStyle: {
						normal: {
							color: chartColor[i],
							//shadowBlur: 40,
							label: {
								show: true,
								position: 'top',
								textStyle: {
									color: chartColor[i],
								}
							}
						}
					},
					data: optionObj.series ? optionObj.series[i].data : null
				};
				arrSeries.push(curSeries)
			}
		}

		var option = {
			title: {
				text: optionObj.title ? optionObj.title.text : '单位：百分比',
				textStyle: {
					fontWeight: 'normal',
					fontSize: 14,
					color: optionObj.title ? optionObj.title.color : '#666'
				},
				padding: optionObj.title ? optionObj.title.padding : [20, 10, 0, 0]
			},
			grid: {
				left: optionObj.grid ? optionObj.grid.left : 10,
				top: optionObj.grid ? optionObj.grid.top : '20%',
				bottom: optionObj.grid ? optionObj.grid.bottom : 20,
				right: optionObj.grid ? optionObj.grid.right : 40,
				containLabel: true
			},
			tooltip: {
				show: true,
				transitionDuration: 0, //防止tooltip的抖动
				backgroundColor: 'rgba(0,0,0,.8)',
				borderColor: 'rgba(0,0,0,.8)',
				borderWidth: 1,
				formatter: '{b}:{c}',
				extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 1)'
			},
			legend: {
				right: 0,
				top: 0,
				data: optionObj.legend ? optionObj.legend.data : ['legend'],
			},
			xAxis: {
				data: optionObj.xAxis ? optionObj.xAxis.data : "",
				boundaryGap: false,
				axisLabel: { //X轴文字
					textStyle: {
						color: '#333'
					},
					interval: optionObj.xAxis.axisLabel ? optionObj.xAxis.axisLabel.interval : 0,
					rotate: optionObj.xAxis.axisLabel ? optionObj.xAxis.axisLabel.rotate : 0
				},
				axisTick: {
					show: false
				},
				axisLine: { //X轴线
					lineStyle: {
						color: ['#999']
					}
				},
				splitLine: { //网格分割线
					show: false,
				},
			},
			yAxis: {
				ayisLine: {
					show: false
				},
				minInterval: 1,
				axisLabel: {
					textStyle: {
						color: '#333'
					}
				},
				splitLine: {
					show: false,
				},
				axisLine: { //Y轴线
					lineStyle: {
						color: '#999'
					}
				}
			},
			series: arrSeries
		};
		return option
	},
	areaLine(optionObj) {
		var arrSeries = [];
		if(optionObj.series) {
			for(var i = 0; i < optionObj.series.length; i++) {
				var curSeries = {
					name: optionObj.series ? optionObj.series[i].name : 'line',
					type: 'line',
					smooth: false,
					showSymbol: false,
					symbol: 'circle',
					symbolSize: 6,
					data: optionObj.series ? optionObj.series[i].data : null,
					areaStyle: {
						color: optionObj.series[i].areaColor || optionObj.series[i].color || chartColor[i]
					},
					itemStyle: {
						normal: {
							color: optionObj.series[i].color || chartColor[i],
						}
					},
					lineStyle: {
						normal: {
							width: 1.5
						}
					}
				};
				arrSeries.push(curSeries)
			}
		}

		var option = {
			grid: {
				left: optionObj.grid ? optionObj.grid.left : '5%',
				top: optionObj.grid ? optionObj.grid.top : '15%',
				bottom: optionObj.grid ? optionObj.grid.bottom : '15%',
				right: optionObj.grid ? optionObj.grid.right : '2%'
			},
			tooltip: {
				trigger: 'axis',
				transitionDuration: 0, //防止tooltip的抖动
				axisPointer: {
					lineStyle: {
						color: '#ddd'
					}
				},
				backgroundColor: 'rgba(255,255,255,1)',
				padding: [5, 10],
				textStyle: {
					color: '#7588E4',
				},
				extraCssText: 'box-shadow: 0 0 5px rgba(0,0,0,0.3)'
			},
			legend: {
				type: "scroll",
				orient: 'horizontal',
				bottom: optionObj.legend ? optionObj.legend.bottom : 20,
				data: optionObj.legend ? optionObj.legend.data : null,
				align: 'left',
				textStyle: {
					color: "#666"
				},
				itemWidth: 10,
				itemHeight: 10,
				itemGap: 35
			},
			xAxis: {
				data: optionObj.xAxis ? optionObj.xAxis.data : "",
				boundaryGap: false,
				axisLabel: { //X轴文字
					textStyle: {
						color: '#333'
					},
					interval: optionObj.xAxis.axisLabel ? optionObj.xAxis.axisLabel.interval : 0,
					rotate: optionObj.xAxis.axisLabel ? optionObj.xAxis.axisLabel.rotate : 0
				},
				axisTick: {
					show: false
				},
				axisLine: { //X轴线
					lineStyle: {
						color: ['#999']
					}
				},
				splitLine: { //网格分割线
					show: false,
				},
				name: optionObj.xAxis ? optionObj.xAxis.name : ''
			},
			yAxis: {
				ayisLine: {
					show: false
				},
				axisLabel: {
					textStyle: {
						color: '#333'
					}
				},
				splitLine: {
					show: false,
				},
				axisLine: { //Y轴线
					lineStyle: {}
				},
				name: optionObj.yAxis ? optionObj.yAxis.name : ''
			},
			series: arrSeries
		};
		return option
	},
	bcNormalLine(optionObj, echart) { //
		var arrSeries = [];
		if(optionObj.series) {
			for(var i = 0; i < optionObj.series.length; i++) {
				var curSeries = {
					name: optionObj.series ? optionObj.series[i].name : 'line',
					type: 'line',
					smooth: true,
					symbolSize: optionObj.series[i].symbolSize ? optionObj.series[i].symbolSize : 10,
					animation: false,
					lineWidth: 1.2,
					hoverAnimation: false,
					symbol: optionObj.series[i].symbol ? optionObj.series[i].symbol : 'circle',
					lineStyle: {
						normal: {
							width: optionObj.series[i].width ? optionObj.series[i].width : 2,
							color: optionObj.series[i].lineColor ? optionObj.series[i].lineColor : chartColor[i],
						}
					},
					itemStyle: {
						normal: {
							color: optionObj.series[i].lineColor ? optionObj.series[i].lineColor : chartColor[i],
							//shadowBlur: 40,
						}
					},
					data: optionObj.series ? optionObj.series[i].data : null,

				};
				if(optionObj.series[i].areaStyle) {
					curSeries.areaStyle = optionObj.series[i].areaStyle
				}
				arrSeries.push(curSeries)
			}
		}
		var option = {
			title: {
				text: optionObj.title ? optionObj.title.text : '',
				textStyle: {
					fontWeight: 'normal',
					fontSize: 14,
					color: optionObj.title ? optionObj.title.color : '#666'
				},
				padding: optionObj.title ? optionObj.title.padding : [20, 10, 0, 0]
			},
			grid: {
				left: optionObj.grid ? optionObj.grid.left : 10,
				top: optionObj.grid ? optionObj.grid.top : '20%',
				bottom: optionObj.grid ? optionObj.grid.bottom : 20,
				right: optionObj.grid ? optionObj.grid.right : 40,
				containLabel: true
			},
			tooltip: {
				trigger: "axis",
				transitionDuration: 0, //防止tooltip的抖动
				axisPointer: {
					type: "shadow",
					label: {
						show: true
					}
				},
				show: true,
				backgroundColor: 'rgba(29,201,183,.8)',
				borderColor: 'rgba(29,201,183,.8)',
				borderWidth: 1,
				extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 1)'
			},
			legend: {
				right: 0,
				top: 0,
				data: optionObj.legend ? optionObj.legend.data : ['legend'],
			},
			xAxis: {
				data: optionObj.xAxis ? optionObj.xAxis.data : "",
				boundaryGap: false,
				axisLabel: { //
					textStyle: {
						color: optionObj.xAxis ? optionObj.xAxis.textStyle : '#333'
					},
					interval: optionObj.xAxis.axisLabel ? optionObj.xAxis.axisLabel.interval : 0,
					rotate: optionObj.xAxis.axisLabel ? optionObj.xAxis.axisLabel.rotate : 0
				},
				axisTick: {
					show: false
				},
				axisLine: {
					lineStyle: {
						color: optionObj.xAxis.axisLine ? optionObj.xAxis.axisLine.lineStyle.color : ['#999'],
					}
				},
				splitLine: { //
					show: false,
				},
			},
			yAxis: {
				ayisLine: {
					show: false
				},
				axisLabel: {
					textStyle: {
						color: optionObj.xAxis ? optionObj.xAxis.textStyle : '#333'
					}
				},
				minInterval: 1,
				splitLine: {
					show: false,
				},
				axisLine: {
					show: optionObj.yAxis.axisLine ? optionObj.yAxis.axisLine.show : true,
					lineStyle: {
						color: optionObj.yAxis.axisLine ? optionObj.yAxis.axisLine.lineStyle.color : '#999'
					}
				},
				axisTick: {
					show: optionObj.yAxis.axisTick ? optionObj.yAxis.axisTick.show : true,
				},
				splitNumber: optionObj.yAxis.splitNumber ? optionObj.yAxis.splitNumber : 7,
			},
			series: arrSeries
		};
		if(optionObj.tooltip) {
			option.tooltip = optionObj.tooltip
			//			option.tooltip =Object.assign({},optionObj.tooltip,option.tooltip)
		}
		return option
	},
	bcMoreVerticalBar(optionObj) { //legend,xAxis,series
		var arrSeries = [];
		let yAxis2;
		if(optionObj.yAxis2) {
			yAxis2 = {
				name: optionObj.yAxis2.name,
				type: "line",
				yAxisIndex: 1, //使用的 y 轴的 index，在单个图表实例中存在多个 y轴的时候有用
				smooth: true, //平滑曲线显示
				showAllSymbol: true, //显示所有图形。
				symbol: "circle", //标记的图形为实心圆
				symbolSize: optionObj.yAxis2.symbolSize ? optionObj.yAxis2.symbolSize : 6, //标记的大小
				itemStyle: {
					//折线拐点标志的样式
					color: optionObj.yAxis2 ? optionObj.yAxis2.color : "#058cff"
				},
				lineStyle: {
					color: optionObj.yAxis2 ? optionObj.yAxis2.color : "#058cff"
				},
				data: optionObj.yAxis2 ? optionObj.yAxis2.data : []
			}
			arrSeries.unshift(yAxis2)
		}
		if(optionObj.series) {
			for(var i = 0; i < optionObj.series.length; i++) {
				var curSeries = {
					name: optionObj.series[i].name,
					type: 'bar',
					stack: optionObj.stack,
					data: optionObj.series[i].data,
					barMinWidth: 0,
					barGap: optionObj.series[i].barGap != undefined ? optionObj.series[i].barGap : '20%',
					barCategoryGap: optionObj.series[i].barCategoryGap != undefined ? optionObj.series[i].barCategoryGap : '20%',
					barWidth: optionObj.series[i].barWidth != undefined ? optionObj.series[i].barWidth : '15%',
					itemStyle: optionObj.series[i].itemStyle || {
						normal: {
							color: optionObj.series[i].color,
						}
					},
					label: optionObj.series[i].label ? optionObj.series[i].label : null
				};
				arrSeries.push(curSeries)
			}
		}
		let option = {
			color: optionObj.color ? optionObj.color : null,
			grid: {
				right: optionObj.grid.right ? optionObj.grid.right : 10,
				top: optionObj.grid.top ? optionObj.grid.top : "25%",
				bottom: optionObj.grid.bottom ? optionObj.grid.bottom : "10%", //也可设置left和right设置距离来控制图表的大小
				left: optionObj.grid.left ? optionObj.grid.left : 10
			},
			//dataZoom: optionObj.dataZoom ? optionObj.dataZoom : [],
			title: {
				text: optionObj.title ? optionObj.title.text : "",
				padding: optionObj.title ? optionObj.title.padding : [20, 0, 0, 20],
				color: optionObj.title ? optionObj.title.color : "#959cbc",
				textStyle: {
					fontSize: 12,
					fontWeight: 'normal',
					color: '#959cbc',
				}
			},
			tooltip: {
				trigger: "axis",
				transitionDuration: 0, //防止tooltip的抖动
				axisPointer: {
					type: "shadow",
					label: {
						show: true,
					}
				},
			},
			legend: {
				type: "scroll",
				orient: 'horizontal',
				icon: optionObj.legend ? optionObj.legend.icon : null,
				bottom: optionObj.legend ? optionObj.legend.bottom : null,
				right: optionObj.legend ? optionObj.legend.right : null,
				top: optionObj.legend ? optionObj.legend.top : null,
				left: optionObj.legend ? optionObj.legend.left : null,
				align: 'left',
				textStyle: {
					color: optionObj.legend.textStyle ? optionObj.legend.textStyle.color : "#666",
					fontSize: optionObj.legend.fontSize ? optionObj.legend.textStyle.fontSize : 12
				},
				padding: optionObj.legend ? optionObj.legend.padding : [0, 0, 0, 0],
				itemWidth: optionObj.legend.itemWidth ? optionObj.legend.itemWidth : 10,
				itemHeight: optionObj.legend.itemHeight ? optionObj.legend.itemHeight : 10,
				itemGap: optionObj.legend.itemGap ? optionObj.legend.itemGap : 35,
				data: optionObj.legend ? optionObj.legend.data : []

			},
			xAxis: {
				type: optionObj.xAxis ? optionObj.xAxis.type : 'category',
				name: optionObj.xAxis ? optionObj.xAxis.name : null,
				data: optionObj.xAxis ? optionObj.xAxis.data : null,
				axisLine: {
					lineStyle: {
						color: optionObj.xAxis.axisLine ? optionObj.xAxis.axisLine.lineStyle.color : ['#384157'],
					}
				},
				axisLabel: { //X轴文字
					textStyle: {
						color: optionObj.xAxis ? optionObj.xAxis.textStyle : '#333'
					},
					interval: optionObj.xAxis.axisLabel ? optionObj.xAxis.axisLabel.interval : 0,
					rotate: optionObj.xAxis.axisLabel ? optionObj.xAxis.axisLabel.rotate : 0,
					formatter: optionObj.xAxis.axisLabel ? optionObj.xAxis.axisLabel.formatter : () => {}
				},
				axisTick: {
					show: false
				},
				splitLine: {
					show: false
				}
			},
			yAxis: [{
					type: optionObj.yAxis ? optionObj.yAxis.type : "value",
          name: optionObj.yAxis ? optionObj.yAxis.name : "",
					nameTextStyle: {
            color: optionObj.nameTextStyle ? optionObj.nameTextStyle.color : "",
            left: optionObj.nameTextStyle ? optionObj.nameTextStyle.left : 12,
            top: optionObj.nameTextStyle ? optionObj.nameTextStyle.top : 12,
					},
					minInterval: 1,
					/*splitLine: {
						show: false
					},*/
					splitLine: optionObj.yAxis.splitLine ? optionObj.yAxis.splitLine : {
						show: false
					},
					axisTick: {
						show: optionObj.yAxis.axisTick ? optionObj.yAxis.axisTick.show : "true",
					},
					axisLine: {
						show: optionObj.yAxis.axisLine ? optionObj.yAxis.axisLine.show : "true",
						lineStyle: {
							color: optionObj.yAxis.axisLine ? optionObj.yAxis.axisLine.lineStyle.color : '#384157',
						}
					},
					axisLabel: {
						show: true,
						textStyle: {
							color: optionObj.yAxis.axisLabel ? optionObj.yAxis.axisLabel.textStyle.color : "#05cdff",
							fontSize: optionObj.yAxis.axisLabel ? optionObj.yAxis.axisLabel.textStyle.fontSize : 14
						}
					},
					data: optionObj.yAxis ? optionObj.yAxis.data : null,
				},
				{
					type: optionObj.yAxis ? optionObj.yAxis.type : "value",
					name: "",
					nameTextStyle: {
						color: optionObj.nameTextStyle ? optionObj.nameTextStyle.color : "#05cdff",
					},
					position: "right",
					splitLine: {
						show: false
					},
					axisTick: {
						show: false
					},
					axisLine: {
						show: false
					},
					axisLabel: {
						show: true,
						formatter: "{value} %", //右侧Y轴文字显示
						textStyle: {
							color: optionObj.yAxis.axisLabel ? optionObj.yAxis.axisLabel.textStyle.color : ["#05cdff"],
							fontSize: optionObj.yAxis.axisLabel ? optionObj.yAxis.axisLabel.textStyle.fontSize : 14
						}
					},
					//data: optionObj.yAxis ? optionObj.yAxis.data : null,
				}
			],
			series: arrSeries

		};
		if(optionObj.tooltip) {
			option.tooltip = Object.assign({}, optionObj.tooltip, option.tooltip)
		}
		return option
	},
	bcNomalPieFun(optionObj) { //常规饼图legend, series
		let option = {
			color: optionObj.color,
			legend: {
				show: optionObj.legend ? optionObj.legend.show : true,
				type: optionObj.legend.type ? optionObj.legend.type : "scroll",
				orient: optionObj.legend.orient ? optionObj.legend.orient : "vartical",
				x: "left",
				icon: 'circle',
				left: optionObj.legend.left ? optionObj.legend.left : '60%',
				bottom: optionObj.legend.bottom ? optionObj.legend.bottom : 0,
				data: optionObj.legend.data,
				formatter: optionObj.legend.formatter || null,
				itemWidth: 8,
				itemHeight: 8,
				itemGap: optionObj.legend.itemGap != undefined ? optionObj.legend.itemGap : 4,
				textStyle: { //图例文字的样式
					color: optionObj.legend.textStyle ? optionObj.legend.textStyle : '#fff',
					fontSize: 16,
					lineHeight: 30,
					rich: optionObj.legend.rich ? optionObj.legend.rich : {}
				},
			},
			title: optionObj.title ? optionObj.title : null,
			graphic: optionObj.graphic ? optionObj.graphic : false,
			tooltip: optionObj.tooltip ? optionObj.tooltip : false,
			series: [{
				type: 'pie',
				clockwise: false, //饼图的扇区是否是顺时针排布
				minAngle: 2, //最小的扇区角度（0 ~ 360）
				radius: optionObj.series ? optionObj.series.radius : "70%",
				center: optionObj.series ? optionObj.series.center : ["20%", "50%"],
				avoidLabelOverlap: false,
				itemStyle: { //图形样式
					normal: {
						borderColor: '#ffffff',
						borderWidth: 1,
					},
				},
				label: {
					normal: {
						show: false,
						position: 'center',
						formatter: function(val) { //让series 中的文字进行换行
							if(optionObj.series.formatter) {
								return val.name.split(" ").join("\n");
							} else {
								return ''
							}
						},
						rich: {
							text: {
								color: "#fff",
								fontSize: 14,
								align: 'center',
								verticalAlign: 'middle',
								padding: 8
							},
							value: {
								color: "#fff",
								fontSize: 16,
								align: 'center',
								verticalAlign: 'middle',
							},
						}
					},
					emphasis: {
						show: true,
						textStyle: {
							fontSize: 16,
						}
					}
				},
				data: optionObj.series.data
			}]
		};
		return option;
	},
}